import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'
import shop from './views/shop.vue'

Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/home',
      name: 'home',
      component: Home
    },
    {
      path: '/admin',
      name: 'layout',
      component: Home,
      children: [
        {path: 'admin', name: 'admin', component: ()=>import('@/views/admin/index.vue')},
        {path: 'pwdReset', name: 'pwdReset', component: ()=>import('@/views/admin/pwdReset.vue')},
        {path: 'goods', name: 'goods', component: ()=>import('@/views/goods/index.vue')},
        {path: 'order', name: 'order', component: ()=>import('@/views/order/index.vue')},
        {path: 'category', name: 'order', component: ()=>import('@/views/goods/category.vue')},

      ]
    },
    {
      path: '/',
      name: 'login',
      component: () => import('@/views/Login.vue')
    },
    {
      path: '/shop',
      name: 'shop',
      component: shop,
      children: [
        {path: 'index', name: 'index', component: ()=>import('@/views/shop/index.vue')},
        {path: 'buy', name: 'buy', component: ()=>import('@/views/shop/buy.vue')},

      ]
    }
  ]
})
